package model_domain;

import java.util.ArrayList;
import java.util.HashSet;
import java.util.List;
import java.util.Set;

public class Course {
	private String name;
	private List<Student> students;
	private ArrayList<Assignment> assignments;
	private Set<String> setOfStrings;
	private HashSet<Integer> hashSetOfInts;
	
	public Course(String qwerty){
		this.name = qwerty;
		students = new ArrayList<Student>();
		assignments = new ArrayList<Assignment>();
		setOfStrings = new HashSet<>();
		setOfStrings.add(name);
		setOfStrings.add("ola");
		hashSetOfInts = new HashSet<Integer>();
		hashSetOfInts.add(Integer.valueOf(1));
		
	}

	public String getName() {
		return name;
	}

	public List<Student> getStudents() {
		return students;
	}

	public List<Assignment> getAssignments() {
		return assignments;
	}
	
	public void addStudent(Student student) throws Exception{
		for (Student s : students) {
			if(student.getName().equals(s.getName())){
				throw new Exception("Student's name already exists");
			}
		}
		students.add(student);
	}
	
	public void addAssignment(Assignment assignment){
		assignments.add(assignment);
	}
	
	public void changeName(String newName){
		System.out.println("Old Name: " + name);
		this.name = newName;
		System.out.println("New Name: " + name);
	}
	
	public void teste(Student student, String details, int year){
	}
}
